#include "EditorWindowModel.h"
#include "PageArea/EditorPageAreaManagerModel.h"
#include "Object/NewObject.h"

#include "EditorWindowGroupModel.h"

void REditorWindowModel::FirstTimeInitializeObject()
{
    Super::FirstTimeInitializeObject();

    PageArea = NewObject<REditorPageAreaManagerModel>(this);
}

void REditorWindowModel::Focuse()
{
    REditorWindowGroupModel::Get()->FocusePageAreaManager(
        GetPageArea()
    );
}


EWindowSizeType REditorWindowModel::GetWindowSizeType() const
{
    return WindowSizeType;
}

void REditorWindowModel::SetWindowSizeType(EWindowSizeType InType)
{
    if (WindowSizeType != InType)
    {
        WindowSizeType = InType;
        OnWindowSizeTypeChanged.ExecuteIfBound();
    }
}

SIntPoint REditorWindowModel::GetWindowSize() const
{
    return WindowSize;
}

void REditorWindowModel::SetWindowSize(const SIntPoint &InSize)
{
    if (WindowSize != InSize)
    {
        WindowSize = InSize;
        OnWindowSizeChanged.ExecuteIfBound();
    }
}

SIntPoint REditorWindowModel::GetWindowPosition() const
{
    return WindowPosition;
}

void REditorWindowModel::SetWindowPosition(const SIntPoint &InPosition)
{
    if (WindowPosition != InPosition)
    {
        WindowPosition = InPosition;
        OnWindowPositionChanged.ExecuteIfBound();
    }
}


TSharedObjectPtr<REditorPageAreaManagerModel> REditorWindowModel::GetPageArea() const
{
    return PageArea;
}
